﻿function getIds(objLink) {
    return objLink.split('=')[1];
}
function getOriginalLink(objLink) {
    return objLink.split('=')[0] + '=';
}
function replaceId(strOriginalLink, arrIds, replacedId, replacedValue) {
    // 1. replace data in array
    arrIds[replacedId] = replacedValue;

    // 2. get original link
    strLink = getOriginalLink(strOriginalLink);

    // 3. build new link
    return buildLink(strLink, arrIds);
}
function buildLink(strLink, arrIds) {
    for (var index = 0; index < arrIds.length; index++) {
        if (arrIds[index] != '') {
            strLink = strLink + arrIds[index] + '-';
        }
    }

    return strLink.substring(0, strLink.length - 1);
}